﻿package net 
{
	import debugs.Debug;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	
	/**
	 * ...
	 * @author keys_star@163.com
	 */
	public class RXml extends EventDispatcher
	{
		private var urlLoad:URLLoader;
		public function RXml() 
		{
			
		}
		public function load(s:String) {
			var u:URLRequest = new URLRequest(s);
			urlLoad = new URLLoader(u);
			urlLoad.addEventListener(Event.COMPLETE, com);
		}
		private function com(e:Event) {
			trace("config")
			var xml:XML = new XML(e.target.data);
			netvars.setVar("length", xml.length.toString());
			var list:XMLList = xml.ph;
			var phItem = new Array;
			for (var i = 0; i < list.length(); i++ ) {
				var nlist:XMLList = list[i].n;
				var arr:Array = new Array;
				for (var j = 0; j < nlist.length(); j++ ) {
					var n = Number(nlist[j]);
					arr.push(n);
				}
				phItem.push(arr);
			}
			
			netvars.setVar("PH", phItem);
			dispatchEvent(e);
		}
	}
}